package com.ght.springboot.api;



import com.ght.springboot.rabbitmq.MessageSender;
import com.ght.springboot.rabbitmq.RabbitmqConfiguration;
import com.ght.springboot.service.FindMeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * @description: 测试接口
 * @author: haitao.gao
 * @create: 2018-08-21 21:31
 **/
@RestController
@RefreshScope
@RequestMapping(value = "/test")
public class TestController {

    @Autowired
    private MessageSender messageSender;

    @Autowired
    private FindMeService findMeService;

//    private IndexOperate indexOperate = new IndexOperate();

    @RequestMapping(value = "/test",method = RequestMethod.POST)
    @ApiOperation(value = "测试数据库连接")
    public String test(@RequestParam("name") String name){

        return findMeService.fineMe(name);
    }


    @RequestMapping(value = "/queue1",method = RequestMethod.POST)
    @ApiOperation(value = "测试业务队列")
    public void queue1(){
        messageSender.sendMsg("这是一条测试消息","test-queue1-routing");
    }

    @RequestMapping(value = "queue2",method = RequestMethod.POST)
    @ApiOperation(value = "测试死信箱队列")
    public void queue2(){
        messageSender.sendMsg("这是一条测试消息","test_death_routing");
    }

    @RequestMapping(value = "/insertBlackAddress",method = RequestMethod.POST)
    @ApiOperation(value =  "黑名单插入数据")
    public void insertBlackAddress(@RequestBody  MultipartFile multipartFile,
                                   @RequestParam("companyId") Integer companyId,
                                   @RequestParam("platformId") Integer platformId){

        try{
//            indexOperate.batchInsert(multipartFile,companyId,platformId);
        }catch (Exception e){
            System.out.print(e);
        }
    }


}
